# Maintainer: leso-kn <info@lesosoftware.com>
pkgname=compiz
pkgver=0.9.14.2
pkgrel=2
pkgdesc="OpenGL window and compositing manager"
url="http://www.compiz.org/"
arch="all"
depends_dev="
	cython
	dbus-glib-dev
	glu-dev
	gtk+3.0-dev
	intltool
	libjpeg-turbo-dev
	libnotify-dev
	libpng-dev
	librsvg-dev
	libsm-dev
	libxext-dev
	libxi-dev
	libxinerama-dev
	libwnck3-dev
	mesa-dev
	metacity-dev
	protobuf-dev
	python3-dev
	startup-notification-dev
	"
makedepends="
	$depends_dev
	boost-dev
	cairo-dev
	cmake
	glibmm-dev
	gtest-dev
	libice-dev
	libx11-dev
	libxcomposite-dev
	libxcursor-dev
	libxdamage-dev
	libxml2-dev
	libxrandr-dev
	libxslt-dev
	pango-dev
	samurai
	xz
	"
subpackages="
	$pkgname-dev:_dev
	$pkgname-utils:_utils:noarch
	$pkgname-lang
	$pkgname-pyc
	"
license=MIT
source="$pkgname-$pkgver.tar.xz::https://launchpad.net/$pkgname/${pkgver%.*}/$pkgver/+download/$pkgname-$pkgver.tar.xz
	basename.patch
	boost.patch
	gtest.patch
	libgen.patch
	opengl.patch
	protobuf.patch
	startup-notification-long.patch
	"

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto" \
	CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \
	cmake -S . -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCOMPIZ_WERROR=OFF
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

_dev() {
	default_dev
	amove usr/share/cmake-*
	amove usr/share/compiz/cmake
	amove usr/share/compiz/xslt
}

_utils() {
	depends="py3-cairo"
	pkgdesc="$pkgdesc (development utilities)"

	amove usr/bin/ccsm
}
sha512sums="
6d064c65be2af5a9676021d35ade64d262f1ddff0e974bd711805b6975d99697bb188f4a13d919b6f0f26a49544305d397d6c74e790b7672caeffc38f74ab145  compiz-0.9.14.2.tar.xz
05c475278ed7d71f06678e2d445c57c7760cdfc9569f16b8f51447c1dce71d47d90da659598cf47625c5ca18eb582ada68c47e1124b1986a5bd28c4e1df346d6  basename.patch
669c32ad7e4428dbbc20bcc8f99764f2c0a28b0641b094fa89abcdf760df82d3fddaf1ac6b0596d0a80c1fe81e641c0ad64b550b93a6dfdf7f4759d687840a8f  boost.patch
2bbc6456deb85474416049eed194d5df7ec6c445f61c8f691f05f86cfee761cb634011fa658f2cd04c6740fea00400d536437bc7f210730f6651c490e96cb6c9  gtest.patch
1b3ada1f7fe818cadff8729a3778f161776be4641e1bf36a2ab185921fbcff2e64b9a1d2576441913c7561e1d327612ebdd4a20fde9941a57b3f32e7084f444c  libgen.patch
aa6b4ba66b512d8cb09b17cd7e30a0ac2ed64ed11ef17613587c1b16c8c6146b2b526aba580b04db03f5b653c4c08ba0e7c57f2edd732a535db5da9f61c7b8f5  opengl.patch
9dd0d4c2361fd56645d2f7b634dee32f1d44a67d36b53e550108acc78a8400bfd3c57132a8a029e9884b9f05cdd3a7533c65355d0a3dd80564544931eaced258  protobuf.patch
2258ab2cf9cea0f3b16c0054b5471e89c11eb75b2dc337e4a2ad63d443435668f383e89e08903085ffc3de78816c41e1d3104e987d792fdf801be85e779faac3  startup-notification-long.patch
"
